Title: SQL W3S (By-BKK) / 028 Right Join
Tags: Obsidian_to_Anki

Q: What does the SQL RIGHT JOIN keyword do?
A: It returns all records from the right table and matching records from the left table

Q: True or False: RIGHT JOIN returns records from both tables, even if there are no matches in the left table
A: True

Q: Which SQL keyword is used to return all records from the right table and only matching records from the left table?
A: RIGHT JOIN

Q: Show the basic syntax for RIGHT JOIN in SQL
A: SELECT column_name(s) FROM table1 RIGHT JOIN table2 ON table1.column_name = table2.column_name;

Q: In some databases, how is RIGHT JOIN also referred to?
A: RIGHT OUTER JOIN

Q: Example: What result will you get with RIGHT JOIN on Orders and Employees tables?
A: All employees and any orders they might have placed

Q: What does this SQL statement do? SELECT Orders.OrderID, Employees.LastName, Employees.FirstName FROM Orders RIGHT JOIN Employees ON Orders.EmployeeID = Employees.EmployeeID ORDER BY Orders.OrderID;
A: Returns all employees, and any orders they placed, sorted by OrderID

Q: RIGHT JOIN always shows all rows from which table, even with no matches?
A: The right table